﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using Wedn.Net.Model;
using Wedn.Net.Utility;
using Wedn.Net.BLL;
using Wedn.Net.Common;

namespace Wedn.Net.UnitTest
{
    [TestClass]
    public class BLLTest
    {
        [TestMethod]
        public void InsertTestMethod()
        {
            #region MyRegion
            ////IBLL.IUserManager manager = new UserManager(); //BLLFactory.BLLFactory.GetBLLFactory().UserManager;
            ////for (int i = 0; i < 15; i++)
            ////{
            ////    manager.Insert(new User { Login = "icestone" + i, NickName = "iceStone" + i, Email = "ice@wedn.net" + i, Password = StringHelper.Encrypt("5love100"), RegDate = DateTime.Now, Role = 0, Status = 0, Link = "http://www.wedn.net" });
            ////}
            ////List<User> list = manager.Select(u => true) as List<User>;
            ////Assert.AreEqual(list.Count > 0, true);
            //var list = new DataModelContainer().Set<Term>().Where<Term>(c => c.Type == (int)TermType.PostCategory).ToList<Term>();
            //foreach (var item in list)
            //{
            //    Console.WriteLine(item.Name);
            //} 
            #endregion


            var terms = BLLFactory.BLLFactory.Instance.TermManager.Select(t => true).ToList();
            foreach (var term in terms)
            {
                term.Count += 1;
                BLLFactory.BLLFactory.Instance.TermManager.Update(term);
            }
            BLLFactory.BLLFactory.Instance.DbSaveChanges();
        }
    }
}
